<template>
  <div style="padding-top: 1rem;">
    <!--拍品列表-->
    <product-list :productList="productList" title="productLots" :release="proRelease" :fixedPrice="fixedPrice"></product-list>

    <pagination :total="total" v-on:listenToChildEvent="getPageIndex"></pagination>
  </div>
</template>

<script>
  import {ipconfig} from '../../../assets/js/ipconfig';
  import {getStatusMapByKey} from '../../../assets/js/tools';
  import {getProductList} from '../../../assets/js/getData';
  export default {
    name: "shopCollection",
    data(){
      return {
        resUrl:ipconfig.resUrl,//图片、视频、音频等资源访问路径

        productList:[],//当前显示拍品列表
        total:null,//总页数

        choiceObj:{
          pageSize:10,//每页显示
          pageNum:1,//第几页
          shopId:null,//店铺ID
          // userId:null,
          type:getStatusMapByKey('eProductType')['collection'].val,//拍品类别：4藏品
        },

        proRelease:null,
        fixedPrice:null,
      }
    },
    created(){
      this.choiceObj.shopId = this.$route.query.shopId;
      // this.choiceObj.userId = this.$route.query.userId;
      this.proRelease = getStatusMapByKey('eProductStatus')['release'].val;
      this.fixedPrice = getStatusMapByKey('eProductType')['fixedPrice'].val;
      this.getProductList(this.choiceObj);

    },
    methods:{
      getPageIndex(pageIndex){
        this.choiceObj.pageNum = parseInt(pageIndex);
        this.getProductList(this.choiceObj);
      },
      //获取拍品列表
      async getProductList(choiceObj){
        let res = await getProductList(choiceObj);
        if(res.data.reqResult.code>0){
          this.productList = res.data.data;
          this.total = Math.ceil(res.data.total / this.choiceObj.pageSize);
        }else {
          Toast(res.data.reqResult.msg);
        }
      },

    },


  }
</script>

<style scoped>

</style>
